package com.springboot.mybatis.mapper;

import com.springboot.mybatis.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectKey;

@Mapper
public interface OrderMapper {

    String insertStr = "INSERT INTO t_order(id,name) VALUES(#{id},#{name})";

    @SelectKey(statement = "select REPLACE(UUID(),'-','')",keyProperty = "id",before = true,
    resultType = String.class)
    @Insert(insertStr)
    void insertOrder(Order order);
}